/*
 * This file is part of WebCL – JavaScript bindings for OpenCL
 * http://webcl.nokiaresearch.com/
 *
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 *
 * Contact: Jari Nikara  ;jari.nikara@nokia.com;
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 *
 * The package is based on a published Khronos OpenCL 1.1 Specification,
 * see http://www.khronos.org/opencl/.
 *
 * OpenCL is a trademark of Apple Inc.
 */

/** \interface IWebCLMemoryObject
 * IWebCLMemoryObject interface abstracts a WebCL memory object such as
 * a buffer or an image.
 * \see cl_mem
 */

#include "nsISupports.idl"
#include "nsISecurityCheckedComponent.idl"
#include "nsIVariant.idl"

#include "WebCL_types.idl"

[scriptable, uuid(e677e482-49e5-40de-ba4f-0e71f301286b)]
interface IWebCLMemoryObject : nsISecurityCheckedComponent
{
  /** Get memory object info.
   * \param aName Name of the info parameter.
   * \return The resulting value.
   * \see clGetMemObjectInfo
   * \see WebCL_types
   */
  [implicit_jscontext]
  nsIVariant getMemObjectInfo (in long aName);

  /** Get image info.
   * \param aName Name of the info parameter.
   * \return The resulting value.
   * \see clGetImageInfo
   * \see WebCL_types
   */
  [implicit_jscontext]
  nsIVariant getImageInfo (in long aName);

  /** Creates a buffer object (referred to as a sub-buffer object) from
   * an existing buffer object.
   * \param aFlags A bit-field that is used to specify allocation and
   *  usage information about the image memory object being created.
   * \param aBufferRegion An object with "size" and "origin" properties of integer type.
   * \see clCreateSubBuffer
   */
  [implicit_jscontext]
  IWebCLMemoryObject createSubBuffer (in T_WebCLMemFlags aFlags,
                                      in nsIVariant aBufferRegion);

  /** Immediately releases all OpenCL-related resources if any are allocated
   * for this object. The object should not be used anymore after calling
   * this function.
   */
  void releaseCLResources ();
};
